﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SMIS.Entities;
using SMIS.Dals;

namespace SMIS
{
    public partial class FormAddIncome : Form
    {
        public FormAddIncome()
        {
            InitializeComponent();
        }

        private void FormAddIncome_Load(object sender, EventArgs e)
        {
            CommonUtil.BindData4ComboBox(cboStaffName, Dal4Income.GetStaffs(), "SName", "SID");
            //DataTable dtIncome = Dal4Income.GetStaffs();
            //cboStaffName.DataSource = dtIncome;
            //cboStaffName.DisplayMember = "SName";
        }

        /// <summary>
        /// 【闻祖东 2013-4-8-193634】按钮的命名，之后不说了，统一的将项目当中存在的所有不规范命名的按钮的名称
        /// 全部改为直接从命名上可以看出这个按钮是做什么的。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Income income = new Income();

            income.Staff = cboStaffName.Text;
            income.Month = txtMonth.Text;
            income.Incomes = txtIncome.Text;
            income.Remark = txtRemark.Text;

            Dal4Income.InsertIncome(income);
            MessageBox.Show("恭喜您添加收入信息成功！","提示");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
